<template>
<nav class="navbar navbar-expand-lg navbar-dark indigo">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText"
    aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarText">
    <ul class="navbar-nav mr-auto">
      <li :class="{'nav-item':true, active:this.$route.path=='/'}">
		<router-link to="/" class="nav-link">Home</router-link> 
      </li>
      <li :class="{'nav-item':true, active:this.$route.path=='/about'}">
		<router-link to="/about" class="nav-link">About</router-link> 
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Pricing</a>
      </li>
    </ul>
    <ul class="navbar-nav ml-auto nav-flex-icons">
      <li class="nav-item">
		  <router-link to="/message" class="nav-link" @click.native="info">消息</router-link> 
      </li>
      <li class="nav-item">
		  <a href="/signin" class="nav-link" >登录</a> 
      </li>
      <li class="nav-item avatar">
        <a class="nav-link p-0" href="#">
          <img :src="this.user.Icon1" class="rounded-circle z-depth-0"
            alt="avatar image" height="35">
        </a>
      </li>
    </ul>
  </div>
</nav>

</template>

<script>

import Users from "../service/users"
var users = new Users()
export default {
	data:()=>{
		return {
			user:{}
		}
	},
	methods: {
		info() {
			this.$notify.info({message: 'Hi! I am info message.', position: 'top right', timeOut: 5000});
		}
	},
	watch: {
		"$route"() {
			console.log("this.path:" , this.path)
			this.path = this.$route.path;
			console.log("path changed " , this.path)
		}
	},
	async created(){
		var data = await users.get()
		this.user = data.Data||{}
		console.log("user", this.user)
	}
}
</script>

<style lang="scss" scoped>

</style>